<!DOCTYPE html>
<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<!-- <meta name="viewport" content="target-densitydpi=device-dpi,width=750,user-scalable=no" /> -->
	<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no" />
	<title>心灵影院</title>
	<meta http-equiv="cleartype" content="on">
    <meta name="apple-mobile-web-app-title" content="...">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <meta http-equiv="x-rim-auto-match" content="none">
    <meta name="apple-touch-fullscreen" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
	<!-- windows phone 点击无高光 -->
	<meta name="msapplication-tap-highlight" content="no">
	<link rel="stylesheet" type="text/css" href="/css/base.css" />
	<link rel="stylesheet" type="text/css" href="/js/mobile/lib/idangerous.swiper.css" />
	<script type="text/javascript" src="/js/mobile/lib/jquery-1.10.1.min.js"></script>
</head>
<body>
	<div class="main">
		<div class="bg-box bg-box2">
			<!-- search -->
			<div class="icon c-back" onclick="window.history.back(-1)"></div>
			<div class="search m-search">

				<!-- <input type="text" name="" placeholder="搜索你要找的影评或影片名称" class="s-input" /> -->
				<a class="s-input" href="/mobilesearch">搜索你要找的影评或影片名称</a>
				<div class="icon s-btn"></div>
			</div>
		</div>
		<!-- 影片展示 -->
		<div class="moves mmove">
			<!-- 电影类型 -->
			<div class="move-type">
				<span class="type-name">类型</span>
				<span class="type-container">
					<div class="swiper-container">
						<div class="swiper-wrapper">
							<div class="swiper-slide" id="category-head">

							</div>
						</div>
					</div>
				</span>
			</div>
			<!-- 加载影片列表的容器 -->
			<div class="m-box" id="ul_comment">

			</div>
			<div class="m-box" id="div_commentfoot">

			</div>

		</div>
		<!-- footer -->
		<div class="footer">如有侵权类似影片，请及时联系本丫删除</div>
	</div>
	<script type="text/javascript" src="/js/mobile/lib/idangerous.swiper.min.js"></script>
	<script type='text/javascript' src='/js/mobile/mobilecom.js' charset='utf-8'></script>
	<!--<script type="text/javascript" src="/js/mobile/tools.js"></script>-->
	<script type="text/javascript">
        var filmObject = {
            pno: 1,
            pagesize: 6,
            allcount: -1,
            filmtype:''
        }
		$(function(){

			(function (doc, win) {

		        var docEl = doc.documentElement,
		            resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
		            oldW = '',clientWidth = '';
		            recalc = function () {

		                clientWidth = $(window).width();

		                if (!clientWidth) return;

		                if(oldW === clientWidth) return false;

		                oldW = clientWidth;

		                docEl.style.fontSize = 100 * (clientWidth / 750) + 'px';

		                setTimeout(function(){

		                	var _num = $(".slide-c").length,_width = $(".slide-c").width();

		                	$(".swiper-slide").width(_width*_num + 10 + "px");

		                	new Swiper(".swiper-container",{

						    	scrollContainer: true
						    })

		                }, 25)
		            };

		        if (!doc.addEventListener) return;

		        win.addEventListener(resizeEvt, recalc, false);

		        recalc();
                var paramstypeid=$.getUrlParam('typeid');
                LoadUrlTitle();
                if (paramstypeid){
                    ClickType(paramstypeid);
                }
                else{
                    ClickType('');
                }
		    })(document, window);
		});

        function  LoadUrlTitle() {
            //<span class="slide-c"  onclick="ClickType(\'\')"><i class="c-tag active">全部</i></span>

            var
				html='<span class="slide-c"  onclick="ClickType(\'\')"><i id="li_type_" class="c-tag active">全部</i></span>';
            $.each(VideoTypeData,function (index,item) {
                html+='<span class="slide-c"  onclick="ClickType('+item.id+')"><i id="li_type_'+item.id+'" class="c-tag ">'+item.name+'</i></span>'
            });
            $('#category-head').html(html);
        }
        function ClickType(typeid){
            $('i[id^="li_type_"]').removeClass('active');
            $('#li_type_'+typeid).addClass('active');
            var typeIdStr='';
            if (typeof (typeid)!='undefined'&& typeid!==''){
                //循环一次
                for(var i=0;i<19;i++){
                    if (i==typeid){
                        typeIdStr+='1';
                    }
                    else{
                        typeIdStr+='_';
                    }
                }
            }
            filmObject.filmtype=typeIdStr;
            filmObject.pno=1;
            LoadVideoList();
        }

        function getHtml(  item) {
            return'<div class="m-img"><img src="'+item.fPhoto+'"></div><div class="m-name">'+item.fName+'</div></span>';
        }
        function worksListTemplate(data){
            if(!data) return false;
            var index = 1,_src = '',_name = '',_classname = "m-list m-flist",//m-list m-elist
                _html = '',_result = '',len = data.length;
            for(var i=0;i<len;i++){
                _src = data[i]["fPhoto"] || "";
                _name = data[i]["fName"] || "暂无信息";
                //index = (index === 4) ? 1 : index;
                _classname = i%3==0  ? "m-list m-flist" : (i%3==1 ? "m-list m-mlist" : "m-list m-elist");
                _html += '<span class="'+_classname+'"  onclick="GoToVideoInfo(\''+data[i]["fId"]+'\')"  data-link="'+data[i]["fId"]+'" >'+
                    '<div class="m-img"><img src="'+_src+'" /></div>'+
                    '<div class="m-name">'+_name+'</div>'+
                    '</span>';
                if(i%3==2 || ( i+1) === len){
                    _result += '<div class="list-box">'+_html+'</div>';
                    _html = '';

                }

                index++;

            }

            return _result;

        }
        function LoadVideoList() {

            $('#div_commentfoot').html('');

            $.ajax({
                type: 'get',
                url:
                '/api/film/getfilmlist?name=&filmtype='+filmObject.filmtype+'&pno='+filmObject.pno+'&pagesize=' +
                ''+filmObject.pagesize+'&allcount=-1',
                dataType: 'json',
                success: function(data){
                    if (mortise_layout.ValidataResult(data)) {
                        //{"code":"OperateOk","errorMsg":"","result":{"list":[{"fId":"594cabc05bc42d07a0aa541a","fName":"一个钓鱼的故事","fFilmtype":"1000010100000000000","fYear":2016,"fCountry":12,"fKeyword":"一个钓鱼的故事","fPhoto":"http://119.10.70.142:9080/Images/upload/videoPhoto/595a87fe37ca1d108069af15.png","fPhotow":"http://101.201.122.79:8083/Images/upload/videoPhoto/596adca774c36b070e69ec8e.jpg","fDirector":"Matt Birman","fPerformer":"Eddie McClintock, Jayne Heitmeyer, Jordyn Negri ","fShowtime":"2016-12-12","fScore":0.0,"fPricetagid":"0","fPricetagname":"免费电影","fIntime":"2017-06-23 14:20:23","fShow":1,"fLookct":0,"fMakelookct":11,"fGoodct":0,"fMakegoodct":12,"fCollect":2,"fMakecollect":13,"fPlayct":132,"fMakepalyct":15,"fSharect":0,"fMakesharect":null,"fBuyct":0,"fCommentct":22,"fSourceurl":null,"fCountryname":"加拿大","fFilmtypename":"喜剧/剧情/奇幻","fImpression":"印象"},{"fId":"5930e4cd1c886e2dc0d45342","fName":"末世迷踪：下一代","fFilmtype":"0000000100000000000","fYear":2016,"fCountry":4,"fKeyword":"末世迷踪：下一代","fPhoto":"http://119.10.70.142:9080/Images/upload/videoPhoto/595a88f137ca1d108069af17.png","fPhotow":"http://101.201.122.79:8083/Images/upload/videoPhoto/596adcc774c36b070e69ec90.jpg","fDirector":"Larry A. McLean","fPerformer":" Amber Frank, Mason Dye, Dylan Sprayberry","fShowtime":"2017-06-02","fScore":0.0,"fPricetagid":"0","fPricetagname":"免费电影","fIntime":"2017-06-02 12:08:34","fShow":1,"fLookct":1,"fMakelookct":15,"fGoodct":2,"fMakegoodct":25,"fCollect":2,"fMakecollect":0,"fPlayct":17,"fMakepalyct":5,"fSharect":1,"fMakesharect":null,"fBuyct":0,"fCommentct":4,"fSourceurl":null,"fCountryname":"美国","fFilmtypename":"奇幻","fImpression":null},{"fId":"594c95065bc42d07a03f1fac","fName":"大婴儿","fFilmtype":"1100010000000000000","fYear":2015,"fCountry":4,"fKeyword":"大婴儿","fPhoto":"http://119.10.70.142:9080/Images/upload/videoPhoto/595a887337ca1d108069af16.png","fPhotow":"http://101.201.122.79:8083/Images/upload/videoPhoto/596adcb874c36b070e69ec8f.jpg","fDirector":"Stephen Langford","fPerformer":"Maureen McCormick, Andrew Lawrence, Ken Davitian","fShowtime":"2015-12-12","fScore":0.0,"fPricetagid":"1","fPricetagname":"2元电影","fIntime":"2017-06-23 12:43:35","fShow":1,"fLookct":0,"fMakelookct":11,"fGoodct":0,"fMakegoodct":12,"fCollect":1,"fMakecollect":13,"fPlayct":11,"fMakepalyct":15,"fSharect":0,"fMakesharect":null,"fBuyct":0,"fCommentct":4,"fSourceurl":null,"fCountryname":"美国","fFilmtypename":"喜剧/爱情/剧情","fImpression":"印象"},{"fId":"594cacc75bc42d07a0aa541b","fName":"正义","fFilmtype":"1100000000000000000","fYear":2016,"fCountry":4,"fKeyword":"正义","fPhoto":"http://119.10.70.142:9080/Images/upload/videoPhoto/595a87a137ca1d108069af14.png","fPhotow":"http://101.201.122.79:8083/Images/upload/videoPhoto/596adc9d74c36b070e69ec8d.jpg","fDirector":"Richard Gabai","fPerformer":" Stephen Lang, Jackson Rathbone, Jamie-Lynn Sigler ","fShowtime":"2016-12-12","fScore":0.0,"fPricetagid":"0","fPricetagname":"免费电影","fIntime":"2017-06-23 14:24:45","fShow":1,"fLookct":0,"fMakelookct":11,"fGoodct":0,"fMakegoodct":12,"fCollect":0,"fMakecollect":13,"fPlayct":4,"fMakepalyct":15,"fSharect":0,"fMakesharect":null,"fBuyct":0,"fCommentct":0,"fSourceurl":null,"fCountryname":"美国","fFilmtypename":"喜剧/爱情","fImpression":"印象"}]},"allcount":0}

                        var videoList = data.result.list;
                        var dataCount=data.result.count;
                        filmObject.allcount=dataCount;
                        //$('#sp_commentct').html(dataCount);
                        if (videoList && videoList.length > 0) {
                            var _html = worksListTemplate(videoList);
                            if(filmObject.pno==1){
                                $('#ul_comment').html(_html);
                            }
                            else{
                                $('#ul_comment').append(_html);
                            }

                            if (dataCount>( filmObject.pno)* filmObject.pagesize){
                                $('#div_commentfoot').html('<span class="get-more-data"  style="cursor:pointer" onclick="loadMore()">点击加载更多...</span>');
                            }
                            else{
                                //over
                                $('#div_commentfoot').html('<span class="get-more-data" >没有数据了...</span>');
                            }
                            //$.detachInfiniteScroll($('.infinite-scroll'));
                            // 删除加载提示符
//                        $('.infinite-scroll-preloader').remove();
//                        $.refreshScroller();


                        }
                        else{
                            $('#ul_comment').html('没有数据了！');
                        }

                    }

                }
            });
        }
        function loadMore() {
            filmObject.pno++;
            LoadVideoList();
        }

	</script>
</body>
</html>